#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve() {
    ll a, b;
    cin >> a >> b;

    auto check = [&](int a, int b) -> bool {
        int sa = 0, sb = 0;
        while (a != 0) {
            sa++; a >>= 1;
        }
        while (b != 0) {
            sb++; b >>= 1;
        }
        if (sb > sa) return false;
        return true;
    };

    if (check(a, b) == false) {
        cout << "-1" << endl;
        return;
    }

    if (a == b) {
        cout << "0" << endl;
        return;
    }

    auto check2 = [&](int a, int b) -> bool {
        int sa = 0, sb = 0;
        while (a != 0) {
            sa++; a >>= 1;
        }
        while (b != 0) {
            sb++; b >>= 1;
        }
        if (sb == sa) return false;
        return true;
    };

    if (check2(a, b) == false) {
        cout << "1" << endl;
        cout << (a ^ b) << endl;
        return;
    }

    auto check3 = [&](int a, int b) {
        int ta = a, tb = b;
        int sa = 0, sb = 0;
        while (a != 0) {
            sa++; a >>= 1;
        }
        while (b != 0) {
            sb++; b >>= 1;
        }
        cout << "2" << endl;
        int t = (1 << (sa - 1));
        int t2 = ta ^ t ^ tb;
        cout << t2 << " " << t << endl;
    };

    check3(a, b);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t-- > 0) {
       solve();
    }
    return 0;
}